Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨introduce v4 action API #930

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from
Open

✨introduce v4 action API #930

wants to merge 1 commit into from

Conversation

cowboyd
Copy link
Member

@cowboyd cowboyd commented Dec 14, 2024

Motivation

The new action API is changing in order to be more in line with the new Promise() constructor, so we want to communicate that change.

The new api is:

action((resolve, reject) => {
  let timeout = setTimeout(() => {}, 1000);
  return () => { clearTimeout(timeout) };
})

As you can see, it is just like new Promise() except the return value is the "uninstall" function. This brings us closer to the Rosetta Stone promise that action() is just like promise constructor.

Approach

This adds the new action API to the old action API in a backwards compatible manner via an overload, and then deprecates the old API.

The new action API is changing in order to be more in line with the
new Promise() constructor, so we want to communicate that change.

This adds the new action API to the old action API in a backwards
compatible manner via an overload, and then deprecates the old API.
@cowboyd cowboyd requested review from taras and neurosnap December 14, 2024 03:54
Copy link
Member

@taras taras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@taras taras enabled auto-merge December 20, 2024 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants